/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * gCCDGUI2.java
 *
 * Created on 19.02.2011, 19:18:45
 */
package alma.ucn.oca.ccd.views;

import alma.ucn.oca.ccd.controller.DefaultController;
import alma.ucn.oca.ccd.utils.*;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.io.File;
import java.io.IOException;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
 *
 * @author JacKFour
 */
public class gCCDGUI2 extends AbstractView {

    private final DefaultController controller;
    private FITSFileDisplay jPanelImage;
    private String currentDir;

    /** Creates new form gCCDGUI2 */
    public gCCDGUI2() {
        this.controller = null;
        initComponents();
    }

    public gCCDGUI2(DefaultController controller) {
        super();
        this.controller = controller;
        currentDir = System.getProperty("user.dir") + "/";
        initComponents();
        jButtonTemperature.setVisible(false);
        jButtonExpTime.setVisible(false);
        jButtonStartExp.setVisible(false);
        jButtonStopExp.setVisible(false);
        jButtonHelp.setVisible(false);
        jButtonAbout.setVisible(false);
        jSeparator3.setVisible(false);
        jSeparator4.setVisible(false);
        jSeparator5.setVisible(false);
    }

    @Override
    public void modelPropertyChange(PropertyChangeEvent evt) {
        repaint();
    }

    public void setImageInfo() {
        //jLabelImageInfoW.setText("" + imagePanel.getImageWidth());
        //jLabelImageInfoH.setText("" + imagePanel.getImageHeight());
        //jLabelImageInfoFr.setText("" + imagePanel.getFrames());
        //jLabelImageInfoFileSz.setText("" + imagePanel.getFileSize());
    }

    protected void fitSizeImageAction(ActionEvent e) {
        if (jPanelImage != null) {
            Dimension fitSize = new Dimension(jScrollPaneImage.getWidth() - 3,
                    jScrollPaneImage.getHeight() - 3);

            jPanelImage.setPreferredSize(fitSize);
            jPanelImage.setSize(fitSize);

            jScrollPaneImage.validate();
        }
        //jRadioButtonMenuItemImageOptionsFitSize.setSelected(true);
    }

    public void saveImage(String savedImagePath) {
        try {
            jPanelImage.save(new File(savedImagePath));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroupToolbar = new javax.swing.ButtonGroup();
        jFileCOpen = new javax.swing.JFileChooser();
        jFileCSave = new javax.swing.JFileChooser();
        jPanelMain = new javax.swing.JPanel();
        jPanelMainToolbar = new javax.swing.JPanel();
        jToolBarMain = new javax.swing.JToolBar();
        jToggleBFile = new javax.swing.JToggleButton();
        jToggleBSettings = new javax.swing.JToggleButton();
        jToggleBControls = new javax.swing.JToggleButton();
        jToggleBImageOpt = new javax.swing.JToggleButton();
        jToggleBHelp = new javax.swing.JToggleButton();
        jPanelButtonsToolbar = new javax.swing.JPanel();
        jToolBarButtons = new javax.swing.JToolBar();
        jButtonOpenFITS = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        jButtonSaveFITS = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JToolBar.Separator();
        jButtonExit = new javax.swing.JButton();
        jButtonTemperature = new javax.swing.JButton();
        jSeparator3 = new javax.swing.JToolBar.Separator();
        jButtonExpTime = new javax.swing.JButton();
        jButtonStartExp = new javax.swing.JButton();
        jSeparator4 = new javax.swing.JToolBar.Separator();
        jButtonStopExp = new javax.swing.JButton();
        jButtonHelp = new javax.swing.JButton();
        jSeparator5 = new javax.swing.JToolBar.Separator();
        jButtonAbout = new javax.swing.JButton();
        jScrollPaneImage = new javax.swing.JScrollPane();

        jFileCOpen.setFileFilter(new FITSFileFilter());

        jFileCSave.setFileFilter(new FITSFileFilter());

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("alma/ucn/oca/ccd/views/Resources"); // NOI18N
        setTitle(bundle.getString("GCCD")); // NOI18N
        setMinimumSize(new java.awt.Dimension(800, 600));

        jToolBarMain.setBackground(new java.awt.Color(153, 153, 255));
        jToolBarMain.setFloatable(false);
        jToolBarMain.setRollover(true);

        buttonGroupToolbar.add(jToggleBFile);
        jToggleBFile.setSelected(true);
        jToggleBFile.setText(bundle.getString("FILE")); // NOI18N
        jToggleBFile.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jToggleBFile.setFocusable(false);
        jToggleBFile.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jToggleBFile.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToggleBFile.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jToggleBFileStateChanged(evt);
            }
        });
        jToolBarMain.add(jToggleBFile);

        buttonGroupToolbar.add(jToggleBSettings);
        jToggleBSettings.setText(bundle.getString("SETTINGS")); // NOI18N
        jToggleBSettings.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jToggleBSettings.setFocusable(false);
        jToggleBSettings.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jToggleBSettings.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToggleBSettings.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jToggleBSettingsStateChanged(evt);
            }
        });
        jToolBarMain.add(jToggleBSettings);

        buttonGroupToolbar.add(jToggleBControls);
        jToggleBControls.setText(bundle.getString("CONTROLS")); // NOI18N
        jToggleBControls.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jToggleBControls.setFocusable(false);
        jToggleBControls.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jToggleBControls.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToggleBControls.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jToggleBControlsStateChanged(evt);
            }
        });
        jToolBarMain.add(jToggleBControls);

        buttonGroupToolbar.add(jToggleBImageOpt);
        jToggleBImageOpt.setText(bundle.getString("IMAGE OPTIONS")); // NOI18N
        jToggleBImageOpt.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jToggleBImageOpt.setFocusable(false);
        jToggleBImageOpt.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jToggleBImageOpt.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBarMain.add(jToggleBImageOpt);

        buttonGroupToolbar.add(jToggleBHelp);
        jToggleBHelp.setText(bundle.getString("HELP")); // NOI18N
        jToggleBHelp.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jToggleBHelp.setFocusable(false);
        jToggleBHelp.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jToggleBHelp.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToggleBHelp.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jToggleBHelpStateChanged(evt);
            }
        });
        jToolBarMain.add(jToggleBHelp);

        javax.swing.GroupLayout jPanelMainToolbarLayout = new javax.swing.GroupLayout(jPanelMainToolbar);
        jPanelMainToolbar.setLayout(jPanelMainToolbarLayout);
        jPanelMainToolbarLayout.setHorizontalGroup(
            jPanelMainToolbarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBarMain, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 723, Short.MAX_VALUE)
        );
        jPanelMainToolbarLayout.setVerticalGroup(
            jPanelMainToolbarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBarMain, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        jToolBarButtons.setBackground(new java.awt.Color(153, 255, 153));
        jToolBarButtons.setFloatable(false);
        jToolBarButtons.setRollover(true);

        jButtonOpenFITS.setText(bundle.getString("OPEN FITS")); // NOI18N
        jButtonOpenFITS.setBorderPainted(false);
        jButtonOpenFITS.setFocusable(false);
        jButtonOpenFITS.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonOpenFITS.setOpaque(false);
        jButtonOpenFITS.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonOpenFITS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonOpenFITSActionPerformed(evt);
            }
        });
        jToolBarButtons.add(jButtonOpenFITS);

        jSeparator1.setOpaque(true);
        jToolBarButtons.add(jSeparator1);

        jButtonSaveFITS.setText(bundle.getString("SAVE FITS")); // NOI18N
        jButtonSaveFITS.setBorderPainted(false);
        jButtonSaveFITS.setFocusable(false);
        jButtonSaveFITS.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonSaveFITS.setOpaque(false);
        jButtonSaveFITS.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonSaveFITS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSaveFITSActionPerformed(evt);
            }
        });
        jToolBarButtons.add(jButtonSaveFITS);

        jSeparator2.setOpaque(true);
        jToolBarButtons.add(jSeparator2);

        jButtonExit.setText(bundle.getString("EXIT GCCD")); // NOI18N
        jButtonExit.setBorderPainted(false);
        jButtonExit.setFocusable(false);
        jButtonExit.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonExit.setOpaque(false);
        jButtonExit.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonExitActionPerformed(evt);
            }
        });
        jToolBarButtons.add(jButtonExit);

        jButtonTemperature.setText(bundle.getString("SET TEMPERATURE")); // NOI18N
        jButtonTemperature.setBorderPainted(false);
        jButtonTemperature.setFocusable(false);
        jButtonTemperature.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonTemperature.setOpaque(false);
        jButtonTemperature.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBarButtons.add(jButtonTemperature);

        jSeparator3.setOpaque(true);
        jToolBarButtons.add(jSeparator3);

        jButtonExpTime.setText(bundle.getString("SET EXPOSURE TIME")); // NOI18N
        jButtonExpTime.setBorderPainted(false);
        jButtonExpTime.setFocusable(false);
        jButtonExpTime.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonExpTime.setOpaque(false);
        jButtonExpTime.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBarButtons.add(jButtonExpTime);

        jButtonStartExp.setText(bundle.getString("START EXPOSURE")); // NOI18N
        jButtonStartExp.setBorderPainted(false);
        jButtonStartExp.setFocusable(false);
        jButtonStartExp.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonStartExp.setOpaque(false);
        jButtonStartExp.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBarButtons.add(jButtonStartExp);

        jSeparator4.setOpaque(true);
        jToolBarButtons.add(jSeparator4);

        jButtonStopExp.setText(bundle.getString("STOP EXPOSURE")); // NOI18N
        jButtonStopExp.setBorderPainted(false);
        jButtonStopExp.setFocusable(false);
        jButtonStopExp.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonStopExp.setOpaque(false);
        jButtonStopExp.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBarButtons.add(jButtonStopExp);

        jButtonHelp.setText(bundle.getString("HELP TOPICS")); // NOI18N
        jButtonHelp.setBorderPainted(false);
        jButtonHelp.setFocusable(false);
        jButtonHelp.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonHelp.setOpaque(false);
        jButtonHelp.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBarButtons.add(jButtonHelp);

        jSeparator5.setOpaque(true);
        jToolBarButtons.add(jSeparator5);

        jButtonAbout.setText(bundle.getString("ABOUT GCCD")); // NOI18N
        jButtonAbout.setBorderPainted(false);
        jButtonAbout.setFocusable(false);
        jButtonAbout.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonAbout.setOpaque(false);
        jButtonAbout.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonAbout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAboutActionPerformed(evt);
            }
        });
        jToolBarButtons.add(jButtonAbout);

        javax.swing.GroupLayout jPanelButtonsToolbarLayout = new javax.swing.GroupLayout(jPanelButtonsToolbar);
        jPanelButtonsToolbar.setLayout(jPanelButtonsToolbarLayout);
        jPanelButtonsToolbarLayout.setHorizontalGroup(
            jPanelButtonsToolbarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBarButtons, javax.swing.GroupLayout.DEFAULT_SIZE, 723, Short.MAX_VALUE)
        );
        jPanelButtonsToolbarLayout.setVerticalGroup(
            jPanelButtonsToolbarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBarButtons, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        javax.swing.GroupLayout jPanelMainLayout = new javax.swing.GroupLayout(jPanelMain);
        jPanelMain.setLayout(jPanelMainLayout);
        jPanelMainLayout.setHorizontalGroup(
            jPanelMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanelMainToolbar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanelButtonsToolbar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jScrollPaneImage, javax.swing.GroupLayout.DEFAULT_SIZE, 723, Short.MAX_VALUE)
        );
        jPanelMainLayout.setVerticalGroup(
            jPanelMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelMainLayout.createSequentialGroup()
                .addComponent(jPanelMainToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jPanelButtonsToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jScrollPaneImage, javax.swing.GroupLayout.DEFAULT_SIZE, 334, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanelMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanelMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jToggleBFileStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jToggleBFileStateChanged
        // TODO add your handling code here:
        if (jToggleBFile.isSelected()) {
            jButtonOpenFITS.setVisible(true);
            jSeparator1.setVisible(true);
            jButtonSaveFITS.setVisible(true);
            jSeparator2.setVisible(true);
            jButtonExit.setVisible(true);
        } else {
            jButtonOpenFITS.setVisible(false);
            jSeparator1.setVisible(false);
            jButtonSaveFITS.setVisible(false);
            jSeparator2.setVisible(false);
            jButtonExit.setVisible(false);
        }
    }//GEN-LAST:event_jToggleBFileStateChanged

    private void jToggleBHelpStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jToggleBHelpStateChanged
        // TODO add your handling code here:
        if (jToggleBHelp.isSelected()) {
            jButtonHelp.setVisible(true);
            jSeparator5.setVisible(true);
            jButtonAbout.setVisible(true);
        } else {
            jButtonHelp.setVisible(false);
            jSeparator5.setVisible(false);
            jButtonAbout.setVisible(false);
        }
    }//GEN-LAST:event_jToggleBHelpStateChanged

    private void jToggleBSettingsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jToggleBSettingsStateChanged
        // TODO add your handling code here:
        if (jToggleBSettings.isSelected()) {
            jButtonTemperature.setVisible(true);
            jSeparator3.setVisible(true);
            jButtonExpTime.setVisible(true);
        } else {
            jButtonTemperature.setVisible(false);
            jSeparator3.setVisible(false);
            jButtonExpTime.setVisible(false);
        }
    }//GEN-LAST:event_jToggleBSettingsStateChanged

    private void jToggleBControlsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jToggleBControlsStateChanged
        // TODO add your handling code here:
        if (jToggleBControls.isSelected()) {
            jButtonStartExp.setVisible(true);
            jSeparator4.setVisible(true);
            jButtonStopExp.setVisible(true);
        } else {
            jButtonStartExp.setVisible(false);
            jSeparator4.setVisible(false);
            jButtonStopExp.setVisible(false);
        }
    }//GEN-LAST:event_jToggleBControlsStateChanged

    private void jButtonOpenFITSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOpenFITSActionPerformed
        // TODO add your handling code here:
        if (jPanelImage == null) {
            jPanelImage = new FITSFileDisplay();
            jPanelImage.addChangeListener(new ChangeListener() {

                @Override
                public void stateChanged(ChangeEvent e) {
                    if (jPanelImage.getSelectedIndex() >= 0) {
                        jPanelImage.setCurrentHDU(jPanelImage.getSelectedIndex());
                        setImageInfo();
                    }
                }
            });
            jScrollPaneImage.setViewportView(jPanelImage);
        }
        if (jFileCOpen == null) {
            jFileCOpen = new JFileChooser(currentDir);
        }
        if (jFileCOpen.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
            try {
                jPanelImage.load(jFileCOpen.getSelectedFile());
                this.setTitle(java.util.ResourceBundle.getBundle("alma/ucn/oca/ccd/views/Resources").getString("GCCD [LOCAL IMAGE] - ")
                        + jFileCOpen.getSelectedFile());
                jPanelImage.load(jFileCOpen.getSelectedFile());
                setImageInfo();
                fitSizeImageAction(null);
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    }//GEN-LAST:event_jButtonOpenFITSActionPerformed

    private void jButtonExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonExitActionPerformed
        // TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_jButtonExitActionPerformed

    private void jButtonAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAboutActionPerformed
        // TODO add your handling code here:
        JOptionPane.showMessageDialog(null, java.util.ResourceBundle.getBundle("alma/ucn/oca/ccd/views/Resources").getString("GCCD 2009 - 2011"),
                java.util.ResourceBundle.getBundle("alma/ucn/oca/ccd/views/Resources").getString("ABOUT..."), JOptionPane.INFORMATION_MESSAGE);
    }//GEN-LAST:event_jButtonAboutActionPerformed

    private void jButtonSaveFITSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveFITSActionPerformed
        // TODO add your handling code here:
        int result = jFileCSave.showSaveDialog(this);
        File fileObj = jFileCSave.getSelectedFile();
        // We get the path to save the image
        if (result == JFileChooser.APPROVE_OPTION) {
            try {
                // We append the .fits extension if it's not found
                if (jFileCSave.getFileFilter().accept(fileObj) == true) {
                    saveImage(fileObj.getAbsolutePath());
                } else {
                    saveImage(fileObj.getAbsolutePath() + ".fits");
                }

            } catch (Exception ex) {
                ex.printStackTrace();
            }
        } else {
            if (result == JFileChooser.CANCEL_OPTION) {
            }
        }
    }//GEN-LAST:event_jButtonSaveFITSActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new gCCDGUI2().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroupToolbar;
    private javax.swing.JButton jButtonAbout;
    private javax.swing.JButton jButtonExit;
    private javax.swing.JButton jButtonExpTime;
    private javax.swing.JButton jButtonHelp;
    private javax.swing.JButton jButtonOpenFITS;
    private javax.swing.JButton jButtonSaveFITS;
    private javax.swing.JButton jButtonStartExp;
    private javax.swing.JButton jButtonStopExp;
    private javax.swing.JButton jButtonTemperature;
    private javax.swing.JFileChooser jFileCOpen;
    private javax.swing.JFileChooser jFileCSave;
    private javax.swing.JPanel jPanelButtonsToolbar;
    private javax.swing.JPanel jPanelMain;
    private javax.swing.JPanel jPanelMainToolbar;
    private javax.swing.JScrollPane jScrollPaneImage;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JToolBar.Separator jSeparator2;
    private javax.swing.JToolBar.Separator jSeparator3;
    private javax.swing.JToolBar.Separator jSeparator4;
    private javax.swing.JToolBar.Separator jSeparator5;
    private javax.swing.JToggleButton jToggleBControls;
    private javax.swing.JToggleButton jToggleBFile;
    private javax.swing.JToggleButton jToggleBHelp;
    private javax.swing.JToggleButton jToggleBImageOpt;
    private javax.swing.JToggleButton jToggleBSettings;
    private javax.swing.JToolBar jToolBarButtons;
    private javax.swing.JToolBar jToolBarMain;
    // End of variables declaration//GEN-END:variables
}
